def singleton(cls):
    __instance = {}

    def inner(*args, **kwargs):
        if cls not in __instance:
            obj = cls(*args, **kwargs)
            __instance[cls] = obj
        return __instance[cls]

    return inner


@singleton
class Person:
    pass


p1 = Person()
p2 = Person()
print(p1 is p2)
